function FindGreatestSumOfSubArray(array)
{
    // write code here
    if(array.length === 0) return 0
    let curSum = 0
    let res = array[0]
    for(let i of array){
      if(curSum > 0){
        curSum += i
      }else{
        curSum = i
      }
      res = res > curSum ? res : curSum
    }
    return res
}
module.exports = {
    FindGreatestSumOfSubArray : FindGreatestSumOfSubArray
};